package com.rabbitmq.rabbitmq.controller;

import com.caicai.domain.User;
import com.rabbitmq.rabbitmq.service.RpcService;
import com.rabbitmq.rabbitmq.service.SendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping(value = "/send")
public class SendController {
	@Autowired
	private SendService sendService;

	@Autowired
	private RpcService rpcService;
	@GetMapping(value = "/str")
	public void sendStrMessage(){
		sendService.sendStr("hello world");
	}


	@GetMapping(value = "/user")
	public  void sendUserMessage(){
		User user=new User();
		user.setId("1");
		user.setName("菜菜");
		user.setSex("男");
		sendService.sendUser(user);
	}


	@GetMapping(value = "/rpc")
	public void sendRpcMessage(){
		Map map=new HashMap();
		rpcService.serdRpcMessage(map);
	}

	@GetMapping(value = "/mutiply")
	public void testMutiplyMessage(){
		sendService.sendMutiply();
	}

	@GetMapping(value = "/falout")
	public void tesFaloutMessage(){
		sendService.sendFaloutMessage();
	}



}
